package cn.itsource.basic.util;

import cn.hutool.http.HttpUtil;
import org.springframework.stereotype.Component;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

@Component //spring管理对象  可以注入
public class SendMessageService {


    public void send(String phone,String code){

        try {
            String encode = URLEncoder.encode("小蔡真狗", "utf-8");
            //java访问这个地址
            HttpUtil.get("http://utf8.api.smschinese.cn/?Uid="+encode+"&Key=BD1F56B7C6C791D1F6F0F908C739D2B3&smsMob="+phone+"&smsText=[宠物乐园验证码]:"+ code);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

    }


}